import http from './http'

export default {
  getPages ({ gid, page = 0, ...params }) {
    let q = http.buildQuery(params)
    return http.get(`api/page?_format=json&gid=${gid}&page=${page}&${q}`)
  },
  getPageDetail (id) {
    return http.get(`api/page/${id}?_format=json`)
  },
  postPage (data) {
    return http.post(`api/page`, data)
  },
  patchPage ({ id, ...data }) {
    return http.patch(`api/page/${id}`, data)
  },
  deletePage (id) {
    return http.delete(`api/page/${id}`)
  }
}
